﻿import { PagedRequestDto } from "@shared/component-base";

export interface IAlipaySettingDto {
  id:number;
  appId:string;
  gatewayUrl:string;
  merchantPrivateKey:string;
  alipayPublicKey:string;
  notifyUrl:string;
  returnUrl:string;
  signType:string;
  sellerId:string;
  charset:string;
  pid:string;
  md5Key:string;
  aliPayHzhbPublicKey:string;
  aliPayHzhbPrivateKey:string;
}

export class AlipaySettingDto implements IAlipaySettingDto {
  id:number;
  appId:string;
  gatewayUrl:string;
  merchantPrivateKey:string;
  alipayPublicKey:string;
  notifyUrl:string;
  returnUrl:string;
  signType:string;
  sellerId:string;
  charset:string;
  pid:string;
  md5Key:string;
  aliPayHzhbPublicKey:string;
  aliPayHzhbPrivateKey:string;

  constructor(data?: IAlipaySettingDto) {
    if (data) {
      for (var property in data) {
        if (data.hasOwnProperty(property))
          (<any>this)[property] = (<any>data)[property];
      }
    }
  }

  init(data?: any) {
    if (data) {
      this.id = data["id"];
      this.appId = data["appId"];
      this.gatewayUrl = data["gatewayUrl"];
      this.merchantPrivateKey = data["merchantPrivateKey"];
      this.alipayPublicKey = data["alipayPublicKey"];
      this.notifyUrl = data["notifyUrl"];
      this.returnUrl = data["returnUrl"];
      this.signType = data["signType"];
      this.sellerId = data["sellerId"];
      this.charset = data["charset"];
      this.pid = data["pid"];
      this.md5Key = data["md5Key"];
      this.aliPayHzhbPublicKey = data["aliPayHzhbPublicKey"];
      this.aliPayHzhbPrivateKey = data["aliPayHzhbPrivateKey"];
      
    }
  }

  static fromJS(data: any): AlipaySettingDto {
    data = typeof data === 'object' ? data : {};
    let result = new AlipaySettingDto();
    result.init(data);
    return result;
  }

  toJSON(data?: any) {
    data = typeof data === 'object' ? data : {};
      data["id"]=this.id;
      data["appId"]=this.appId;
      data["gatewayUrl"]=this.gatewayUrl;
      data["merchantPrivateKey"]=this.merchantPrivateKey;
      data["alipayPublicKey"]=this.alipayPublicKey;
      data["notifyUrl"]=this.notifyUrl;
      data["returnUrl"]=this.returnUrl;
      data["signType"]=this.signType;
      data["sellerId"]=this.sellerId;
      data["charset"]=this.charset;
      data["pid"]=this.pid;
      data["md5Key"]=this.md5Key;
      data["aliPayHzhbPublicKey"]=this.aliPayHzhbPublicKey;
      data["aliPayHzhbPrivateKey"]=this.aliPayHzhbPrivateKey;

    return data;
  }

  clone() {
    const json = this.toJSON();
    let result = new AlipaySettingDto();
    result.init(json);
    return result;
  }
}

export class AlipaySettingListQueryDto extends PagedRequestDto {
  phone: string;
  keywords: string;

  init(data?: any) {
    if (data) {
      this.pageIndex = data["pageIndex"];
      this.pageSize = data["pageSize"];
      this.sortField = data["sortField"];
      this.sortOrder = data["sortOrder"];
      this.keywords = data["keywords"];
    }
  }

  toJSON(data?: any) {
    data = typeof data === 'object' ? data : {};
    data["pageIndex"] = this.pageIndex;
    data["pageSize"] = this.pageSize;
    data["sortField"] = this.sortField;
    data["sortOrder"] = this.sortOrder;
    data["keywords"] = this.keywords;
    return data;
  }
}

export interface IAlipaySettingEditDto {
  id:number;
  appId:string;
  gatewayUrl:string;
  merchantPrivateKey:string;
  alipayPublicKey:string;
  notifyUrl:string;
  returnUrl:string;
}

export class AlipaySettingEditDto implements IAlipaySettingEditDto {
  id:number;
  appId:string;
  gatewayUrl:string;
  merchantPrivateKey:string;
  alipayPublicKey:string;
  notifyUrl:string;
  returnUrl:string;

  constructor(data?: IAlipaySettingEditDto) {
    if (data) {
      for (var property in data) {
        if (data.hasOwnProperty(property))
          (<any>this)[property] = (<any>data)[property];
      }
    }
  }

  init(data?: any) {
    if (data) {
      this.id = data["id"];
      this.appId = data["appId"];
      this.gatewayUrl = data["gatewayUrl"];
      this.merchantPrivateKey = data["merchantPrivateKey"];
      this.alipayPublicKey = data["alipayPublicKey"];
      this.notifyUrl = data["notifyUrl"];
      this.returnUrl = data["returnUrl"];
      
    }
  }

  static fromJS(data: any): AlipaySettingEditDto {
    data = typeof data === 'object' ? data : {};
    let result = new AlipaySettingEditDto();
    result.init(data);
    return result;
  }

  toJSON(data?: any) {
    data = typeof data === 'object' ? data : {};
      data["id"]=this.id;
      data["appId"]=this.appId;
      data["gatewayUrl"]=this.gatewayUrl;
      data["merchantPrivateKey"]=this.merchantPrivateKey;
      data["alipayPublicKey"]=this.alipayPublicKey;
      data["notifyUrl"]=this.notifyUrl;
      data["returnUrl"]=this.returnUrl;

    return data;
  }

  clone() {
    const json = this.toJSON();
    let result = new AlipaySettingEditDto();
    result.init(json);
    return result;
  }
}


